package com.bing.Impl;

import com.bing.util.Context;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * Created by Administrator on 2014/6/28.
 */
@Component
public class EndStep extends AbstrcatStep {
    private final static Logger logger = LoggerFactory.getLogger(EndStep.class);


    @Override
    public void preStart(Context context) {
        super.preStart(context);
    }

    @Override
    public void end(Context context) {
        super.end(context);

        long endTime = System.currentTimeMillis();
        long startTime= (long) context.getSetting("startTime");
        long totalTime = (endTime - startTime) / (1000 * 60);
        if (context.getTaoListener() != null) {
            context.getTaoListener().setStatus("刷单成功,用时:" + totalTime + "分");
            context.getTaoListener().enableShua("刷一下");
            taoListener.setTitle("");
        }

        logger.info("总计用时: {}", totalTime);
    }

    /**
     * 刷完
     */
    @Override
    public void exec(Context context) {
        logger.info("结束流程");
        driver.quit();
    }


}
